{extend name="Teacher/nav"}
{block name="title"}个人信息{/block}
{block name="content"}

<div class="row" >
    <div class="col-md-4" ></div>
    <div class="col-md-3" style="border: 1px  dotted gray; border-radius: 5px;">
        <div style="margin: 0px 50px 0px 50px;">
            <form class="form-horizontal" action="{:url('saveInformation')}" method="post">
                <div class="form-group" style="margin-top: 50px;margin-bottom: 30px;">
                    <label>身份:</label>
                    <label>老师</label>
                </div>
                <div class="form-group" style="margin-bottom: 45px;">
                    <label >姓名:<input type="text" class="form-inline" name="name" value="{$teacher->name}"></label>
                    <input type="hidden" name="id" value="{$teacher->getData('id')}">
                </div>
                <br>
            <!--选择所教的班级-->

            <div class="form-group">
                <button type="button" class="btn btn-primary " data-toggle="modal" data-target="#addKlass">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                    添加班级
                </button>
                <!--//删除班级的按钮-->
                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#deleteKlass">
                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                    删除班级
                </button>
                <br><br>
                <div class="container">
                    <label><h4>所教班级：</h4></label><br>
                    {volist name="tcolleges" id="College"}
                    <div class="container">
                    <label>{$College->name}:</label>
                        <div>
                            {volist name="tmajors" id="Major"}
                            <div {neq name="$Major->college_id" value="$College->id" } hidden="hidden" {/neq}>
                                <div>
                                    {volist name="tgrades" id="Grade"}
                                    <div {neq name="$Grade->major_id" value="$Major->id" } hidden="hidden" {/neq}>
                                        <div class="container">
                                            {volist name="tklass" id="Klass"}
                                            <div {neq name="$Klass->grade_id" value="$Grade->id" } hidden="hidden" {/neq}>
                                                {$Klass->name}
                                            </div>
                                            {/volist}
                                        </div>
                                    </div>
                                    {/volist}
                                </div>
                            </div>
                            {/volist}
                        </div>
                    </div>
                    {/volist}
                </div>
            </div>

        <hr>
        <!--//展示所教的课程-->
        <div class="form-group">

                <!--//添加课程的按钮-->
                <button type="button" class="btn btn-primary " data-toggle="modal" data-target="#addCourse">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                    添加课程
                </button>
                <!--//删除课程的按钮-->
                <button type="button" class="btn btn-primary " data-toggle="modal" data-target="#deleteCourse">
                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                    删除课程
                </button>
                <br><br>
               <div class="container">
                   <h4>所教课程：</h4>
                   <div class="container">
                       {volist name="courses" id="Course"}
                       <label>
                           {$Course->name}
                       </label><br>
                       {/volist}
                   </div>
               </div>
             </div>
        </div>

        <br><br><br>
        <button type="submit" class="btn btn-primary" style="margin-left: 100px;">保存</button>
    </form>
</div>
<!--增加课程的表单-->
<div class="modal fade" id="addCourse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="{:url('addCourse')}" class="form-inline" method="post">
                <div class="modal-body">
                    <label>课程名称:</label>
                    <input name="newCourseName" placeholder="请输入要增加的课程名">
                    <input type="hidden" name="teacherId" value="{$teacher->id}" class="form-control">
                    <input name="fromInformation" value="1" hidden="hidden">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!--删除课程的表单-->
<form action="{:url('deleteCourse')}" method="post">
    <div class="modal fade" id="deleteCourse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="container">
                        <label>课程名称:</label>
                        <div class="container">
                            {volist name="courses" id="Course" key="key"}
                            <input type="checkbox" value="{$Course->id}" name="ids[{$key}]" id="course{$key}">
                            <label for="course{$key}">{$Course->name}</label>
                            <br>
                            {/volist}
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">确定</button>
                </div>
            </div>
        </div>
    </div>
</form>

<!--添加班级-->
<form action="{:url('addKlass')}" method="post">
    <div class="modal fade bs-example-modal-lg" id="addKlass" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel">
        <div class="modal-dialog modal-lg " role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <br>
                    <div class="col-md-3 row">
                        <label class="col-md-4 select_label">学院</label>
                        <div class="col-md-8">
                            <select id="college" class="form-control" onchange="yunzhi.getMajor('college', 'major', 'grade', 'klass')">
                                {volist name="colleges" id = "College"}
                                <option value="{$College->id}">
                                    {$College->name}
                                </option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="col-md-3 row">
                        <label class="col-md-4 select_label">专业</label>
                        <div class="col-md-8">
                            <select id="major" class="form-control" onchange="yunzhi.getGrade('major', 'grade', 'klass')">
                                <option>
                                </option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-3 row">
                        <label class="col-md-4 select_label">年级</label>
                        <div class="col-md-8">
                            <select id="grade" class="form-control" onchange="yunzhi.getKlass('grade', 'klass')">
                                <option>
                                </option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-3 row">
                        <label class="col-md-4 select_label">班级</label>
                        <div class="col-md-8">
                            <select id="klass" class="form-control" onchange="yunzhi.getKlassId('klass')">
                                <option>
                                </option>
                            </select>
                        </div>
                    </div>
                </div>
                <br/>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">确定</button>
                </div>
            </div>
        </div>
    </div>
</form>

<!--删除班级-->
<form action="{:url('deleteKlass')}" method="post">
    <input type="hidden" value="{$teacher->id}" name="teacherId">
    <div class="modal fade" id="deleteKlass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body container">
                    {volist name="tcolleges" id="College"}
                    <label>{$College->name}:</label>
                    <div>
                        {volist name="tmajors" id="Major"}
                        <div {neq name="$Major->college_id" value="$College->id" } hidden="hidden" {/neq}>
                            <div>
                                {volist name="tgrades" id="Grade"}
                                <div {neq name="$Grade->major_id" value="$Major->id" } hidden="hidden" {/neq}>
                                    <div class="container">
                                        {volist name="tklass" id="Klass"}
                                        <div {neq name="$Klass->grade_id" value="$Grade->id" } hidden="hidden" {/neq} >

                                            <label><input type="checkbox" value="{$Klass->id}" name="ids[{$key}]">{$Klass->name}</label>
                                        </div>
                                        {/volist}
                                    </div>
                                </div>
                                {/volist}
                            </div>
                        </div>
                        {/volist}
                    </div>
                    {/volist}
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">确定</button>
                </div>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" src="/labManageSystem/public/login/studentRegister.js"></script>
<script>
    yunzhi.getMajor('college', 'major', 'grade', 'klass');
</script>
{/block}

